home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CAppendiceSearch.as < prev    next >
Text File  |  2007-11-08  |  29KB  |  856 lines

  1. class CAppendiceSearch
  2. {
  3.    var mLemma = null;
  4.    var mContributo = null;
  5.    var mProspettiva = null;
  6.    var mSearchInitialized = false;
  7.    var mProspettiveInitialized = false;
  8.    static var GATEWAY_URL = "http://127.0.0.1/flashservices/gateway.php";
  9.    static var CONTRIBUTI_URL = "http://127.0.0.1/xxi/contributi/";
  10.    static var EMBEDDEDIMAGE_URL = "http://127.0.0.1/xxi/formule/";
  11.    static var PROSPETTIVE_URL = "http://127.0.0.1/xxi/prospettive/";
  12.    static var EXPORTHTML_URL = "htmlexport.php";
  13.    static var SERVICE_NAME = "CAppendiceBrowserServlet_a4";
  14.    static var CREDITS_URL = "credits.swf";
  15.    static var HELP_URL = "help.swf";
  16.    static var MENU_PROSPETTIVE_URL = "prospettive.swf";
  17.    var mSearchType = "mostra";
  18.    var mSearchData = null;
  19.    var mPagePrefetch = 4;
  20.    function CAppendiceSearch(root)
  21.    {
  22.       this.mRoot = root;
  23.       this.mSearchInitialized = false;
  24.       this.mProspettiveInitialized = false;
  25.       this.init();
  26.    }
  27.    function InitSearch(inForce)
  28.    {
  29.       if(this.mSearchInitialized == false || inForce == true)
  30.       {
  31.          this.mSearchInitialized = true;
  32.          this.mRoot.searchTypeGroup.dispatchEvent({type:"click",target:_root.searchTypeGroup});
  33.       }
  34.    }
  35.    function InitMenuProspettive(inForce)
  36.    {
  37.       if(this.mProspettiveInitialized == false || inForce == true)
  38.       {
  39.          _global.gAlert.ShowAlert("","Inizializzazione del menu prospettive in corso","EMPTY",10);
  40.          var _loc3_ = this.mService.DoGetProspettiveList();
  41.          _loc3_.__set__responder(new mx.rpc.RelayResponder(this,"handleDoGetProspettiveList","handleError"));
  42.       }
  43.    }
  44.    function handleDoGetProspettiveList(re)
  45.    {
  46.       this.mRoot.mc_MenuProspettive.InitMenuProspettive(re.result);
  47.       this.mProspettiveInitialized = true;
  48.       _global.gAlert.Hide();
  49.    }
  50.    function init()
  51.    {
  52.       mx.remoting.debug.NetDebug.initialize();
  53.       this.mHistory = new CHistory();
  54.       this.mTornaArray = new Array();
  55.       this.mContributo = new CAppendiceContributo(CAppendiceSearch.CONTRIBUTI_URL);
  56.       this.mProspettiva = new CAppendiceProspettiva(CAppendiceSearch.PROSPETTIVE_URL);
  57.       this.mLemma = new CAppendiceLemma(CAppendiceSearch.CONTRIBUTI_URL,CAppendiceSearch.PROSPETTIVE_URL);
  58.       if(_global.gDVD == true)
  59.       {
  60.          this.mService = new CAppendiceOfflineService(this);
  61.       }
  62.       else
  63.       {
  64.          this.mService = new mx.remoting.Service(CAppendiceSearch.GATEWAY_URL,null,CAppendiceSearch.SERVICE_NAME);
  65.       }
  66.       this.initUI();
  67.    }
  68.    function SearchResultsIconManager(itemObj)
  69.    {
  70.       if(itemObj == undefined)
  71.       {
  72.          return undefined;
  73.       }
  74.       switch(itemObj.icon)
  75.       {
  76.          case "L":
  77.             return "lemmaIcon";
  78.          case "S":
  79.             return "sottolemmaIcon";
  80.          case "R":
  81.             return "rinvioIcon";
  82.          default:
  83.             return "emptyIcon";
  84.       }
  85.    }
  86.    function doSearch(searchWords, excludeWords, searchParm)
  87.    {
  88.       var _loc3_ = "La ricerca inserita ├¿ in corso di esecuzione.";
  89.       if(this.mSearchType == "mostra")
  90.       {
  91.          _loc3_ = "Caricamento dell\'indice alfabetico in corso.";
  92.       }
  93.       _global.gAlert.ShowAlert("",_loc3_,"EMPTY",10);
  94.       var _loc4_ = this.mService.DoVociSearch(searchWords,excludeWords,searchParm);
  95.       _loc4_.__set__responder(new mx.rpc.RelayResponder(this,"handleDoVociSearch","handleError"));
  96.       var _loc7_ = this.mService.DoContributiSearch(searchWords,excludeWords,searchParm);
  97.       _loc7_.__set__responder(new mx.rpc.RelayResponder(this,"handleDoContributiSearch","handleError"));
  98.       _loc7_ = this.mService.DoProspettiveSearch(searchWords,excludeWords,searchParm);
  99.       _loc7_.__set__responder(new mx.rpc.RelayResponder(this,"handleDoProspettiveSearch","handleError"));
  100.    }
  101.    function doGetLemma(inLemma, inCallback)
  102.    {
  103.       var _loc3_ = this.mService.DoGetLemma(inLemma.mId);
  104.       _loc3_.__set__responder(new mx.rpc.RelayResponder(this,inCallback,"handleError"));
  105.       _global.gAlert.ShowAlert("","Caricamento della voce \"" + inLemma.mTitolo + "\" in corso..","EMPTY",10);
  106.    }
  107.    function doGetContributo(inContributo, inCallbackHandler)
  108.    {
  109.       var _loc3_ = this.mService.DoGetContributo(inContributo.mId);
  110.       _loc3_.__set__responder(new mx.rpc.RelayResponder(this,inCallbackHandler,"handleError"));
  111.       _global.gAlert.ShowAlert("","Caricamento del contributo \"" + inContributo.mTitolo + "\" in corso..","EMPTY",10);
  112.    }
  113.    function doGetProspettiva(inProspettiva, inCallbackHandler)
  114.    {
  115.       var _loc3_ = this.mService.DoGetProspettiva(inProspettiva.mId);
  116.       _loc3_.__set__responder(new mx.rpc.RelayResponder(this,inCallbackHandler,"handleError"));
  117.       _global.gAlert.ShowAlert("","Caricamento della prospettiva \"" + inProspettiva.mTitolo + "\" in corso..","EMPTY",10);
  118.    }
  119.    function doLookUp(inStr)
  120.    {
  121.       _global.gAlert.ShowAlert("","Caricamento dell\'indice alfabetico in corso.","EMPTY",10);
  122.       var _loc3_ = this.mService.DoLookUp(inStr);
  123.       _loc3_.__set__responder(new mx.rpc.RelayResponder(this,"handleDoLookUp","handleError"));
  124.    }
  125.    function handleDoVociSearch(re)
  126.    {
  127.       this.mRoot.mc_SearchResult.SetResults("voci",re.__get__result());
  128.    }
  129.    function handleDoContributiSearch(re)
  130.    {
  131.       this.mRoot.mc_SearchResult.SetResults("contributi",re.__get__result());
  132.       _global.gAlert.Hide();
  133.    }
  134.    function handleDoProspettiveSearch(re)
  135.    {
  136.       this.mRoot.mc_SearchResult.SetResults("prospettive",re.__get__result());
  137.       _global.gAlert.Hide();
  138.    }
  139.    function handledoGetContributo(re)
  140.    {
  141.       if(re.__get__result() && re.__get__result().id)
  142.       {
  143.          this.mContributo.InitFromResult(re.__get__result());
  144.          this.OpenContributiWindow(this.mContributo);
  145.       }
  146.       _global.gAlert.Hide();
  147.    }
  148.    function handledoGetContributoPreview(re)
  149.    {
  150.       if(re.__get__result() && re.__get__result().id)
  151.       {
  152.          this.mContributo.InitFromResult(re.__get__result());
  153.          this.ShowContributiPreview(this.mContributo);
  154.       }
  155.       _global.gAlert.Hide();
  156.    }
  157.    function handledoGetProspettiva(re)
  158.    {
  159.       if(re.__get__result())
  160.       {
  161.          this.mProspettiva.InitFromResult(re.__get__result());
  162.          this.OpenProspettiveWindow(this.mProspettiva,"ricerca");
  163.       }
  164.       _global.gAlert.Hide();
  165.    }
  166.    function handledoGetProspettivaPreview(re)
  167.    {
  168.       if(re.__get__result())
  169.       {
  170.          this.mProspettiva.InitFromResult(re.__get__result());
  171.          this.ShowProspettivePreview(this.mProspettiva);
  172.       }
  173.       _global.gAlert.Hide();
  174.    }
  175.    function handledoGetLemma(re)
  176.    {
  177.       if(re.__get__result())
  178.       {
  179.          this.mLemma.InitFromResult(re.__get__result());
  180.          this.OpenLemmaWindow(this.mLemma);
  181.       }
  182.       _global.gAlert.Hide();
  183.    }
  184.    function handledoGetLemmaPreview(re)
  185.    {
  186.       if(re.__get__result())
  187.       {
  188.          this.mLemma.InitFromResult(re.__get__result());
  189.          this.ShowLemmaPreview(this.mLemma);
  190.       }
  191.       _global.gAlert.Hide();
  192.    }
  193.    function handleDoLookUp(re)
  194.    {
  195.       var _loc3_ = re.__get__result();
  196.       if(_loc3_)
  197.       {
  198.          var _loc5_ = this.mRoot.mc_SearchResult.GetTabList("voci");
  199.          _loc5_.vPosition = parseInt(_loc3_.voci);
  200.          var _loc4_ = this.mRoot.mc_SearchResult.GetTabList("contributi");
  201.          _loc4_.vPosition = parseInt(_loc3_.contributi);
  202.          _loc4_ = this.mRoot.mc_SearchResult.GetTabList("prospettive");
  203.          _loc4_.vPosition = parseInt(_loc3_.contributi);
  204.       }
  205.       _global.gAlert.Hide();
  206.    }
  207.    function handleError(rs)
  208.    {
  209.       this.mRoot.btStartSearch.enabled = true;
  210.       _global.gAlert.ShowAlert("","Impossibile connettersi al Database","OK",10);
  211.       return undefined;
  212.    }
  213.    function MostraLemma(id, tipo, titolo, inFrom, inDoubleClick, inStatus)
  214.    {
  215.       if(this.mLemma.mId != id)
  216.       {
  217.          this.mLemma.NewLemma(id,tipo,titolo);
  218.       }
  219.       this.mLemma.mFrom = inFrom;
  220.       this.mLemma.mStatus = inStatus;
  221.       if(inDoubleClick)
  222.       {
  223.          if(this.mLemma.mInitialized == false)
  224.          {
  225.             this.doGetLemma(this.mLemma,"handledoGetLemma");
  226.          }
  227.          else
  228.          {
  229.             this.OpenLemmaWindow(this.mLemma);
  230.          }
  231.       }
  232.       else if(this.mLemma.mInitialized == false)
  233.       {
  234.          this.doGetLemma(this.mLemma,"handledoGetLemmaPreview");
  235.       }
  236.       else
  237.       {
  238.          this.ShowLemmaPreview(this.mLemma);
  239.       }
  240.    }
  241.    function MostraProspettiva(id, tipo, titolo, inFrom, inDoubleClick)
  242.    {
  243.       if(this.mProspettiva.mId != id)
  244.       {
  245.          this.mProspettiva.NewProspettiva(id,tipo,titolo);
  246.       }
  247.       this.mProspettiva.mFrom = inFrom;
  248.       if(inDoubleClick)
  249.       {
  250.          if(this.mProspettiva.mFile == "")
  251.          {
  252.             this.doGetProspettiva(this.mProspettiva,"handledoGetProspettiva");
  253.          }
  254.          else
  255.          {
  256.             this.OpenProspettiveWindow(this.mProspettiva);
  257.          }
  258.       }
  259.       else if(this.mProspettiva.mFile == "")
  260.       {
  261.          this.doGetProspettiva(this.mProspettiva,"handledoGetProspettivaPreview");
  262.       }
  263.       else
  264.       {
  265.          this.ShowProspettivePreview(this.mProspettiva);
  266.       }
  267.    }
  268.    function MostraContributo(id, tipo, titolo, inFrom, inDoubleClick)
  269.    {
  270.       if(this.mContributo.mId != id)
  271.       {
  272.          this.mContributo.NewContributo(id,tipo,titolo);
  273.       }
  274.       this.mContributo.mFrom = inFrom;
  275.       if(inDoubleClick)
  276.       {
  277.          if(this.mContributo.mFile == "")
  278.          {
  279.             this.doGetContributo(this.mContributo,"handledoGetContributo");
  280.          }
  281.          else
  282.          {
  283.             this.OpenContributiWindow(this.mContributo);
  284.          }
  285.       }
  286.       else if(this.mContributo.mFile == "")
  287.       {
  288.          this.doGetContributo(this.mContributo,"handledoGetContributoPreview");
  289.       }
  290.       else
  291.       {
  292.          this.ShowContributiPreview(this.mContributo);
  293.       }
  294.    }
  295.    function GetSearchData()
  296.    {
  297.       var _loc2_ = new Object();
  298.       _loc2_.caseSensitive = this.mRoot.cbCaseSensitive.selected;
  299.       _loc2_.fullTextSearch = this.mRoot.rbFullSearch.selected;
  300.       _loc2_.wholeWord = this.mRoot.cbWholeWords.selected;
  301.       _loc2_.allWords = this.mRoot.rbAndSearch.selected;
  302.       _loc2_.searchType = this.mSearchType;
  303.       _loc2_.searchedText = this.mRoot.ibSearchInput.text;
  304.       return _loc2_;
  305.    }
  306.    function GetSearchDataStr()
  307.    {
  308.       var _loc2_ = undefined;
  309.       var _loc3_ = this.GetSearchData();
  310.       _loc2_ = "";
  311.       _loc2_ += String(!_loc3_.caseSensitive ? 0 : 1);
  312.       _loc2_ += "," + String(!_loc3_.fullTextSearch ? 0 : 1);
  313.       _loc2_ += "," + String(!_loc3_.wholeWord ? 0 : 1);
  314.       _loc2_ += "," + String(!_loc3_.allWords ? 0 : 1);
  315.       _loc2_ += "," + String(!_loc3_.searchType ? 0 : 1);
  316.       return _loc2_;
  317.    }
  318.    function onSearch()
  319.    {
  320.       var _loc5_ = undefined;
  321.       var _loc10_ = StringUtils.trim(this.mRoot.ibSearchInput.text);
  322.       var _loc11_ = StringUtils.trim(this.mRoot.ibExcludeWords.text);
  323.       this.mSearchData = this.GetSearchData();
  324.       if(this.mSearchType == "mostra")
  325.       {
  326.          _loc5_ = _root.gNormalize.Normalize(_loc10_);
  327.          var _loc13_ = StringUtils.trim(_loc5_.text);
  328.          this.doLookUp(_loc13_);
  329.       }
  330.       else
  331.       {
  332.          if(_loc10_ == "" && _loc11_ == "")
  333.          {
  334.             _global.gAlert.ShowAlert("","Inserire la parola da ricercare","OK",10);
  335.             return undefined;
  336.          }
  337.          var _loc12_ = this.GetSearchDataStr();
  338.          var _loc6_ = "";
  339.          var _loc9_ = _loc10_.split(" ");
  340.          var _loc4_ = 0;
  341.          while(_loc4_ < _loc9_.length)
  342.          {
  343.             _loc5_ = _root.gNormalize.Normalize(_loc9_[_loc4_]);
  344.             if(_loc4_ > 0)
  345.             {
  346.                _loc6_ += ",";
  347.             }
  348.             _loc6_ += StringUtils.trim(_loc5_.text);
  349.             _loc4_ = _loc4_ + 1;
  350.          }
  351.          var _loc7_ = "";
  352.          var _loc8_ = _loc11_.split(" ");
  353.          _loc4_ = 0;
  354.          while(_loc4_ < _loc8_.length)
  355.          {
  356.             _loc5_ = _root.gNormalize.Normalize(_loc8_[_loc4_]);
  357.             if(_loc4_ > 0)
  358.             {
  359.                _loc7_ += ",";
  360.             }
  361.             _loc7_ += StringUtils.trim(_loc5_.text);
  362.             _loc4_ = _loc4_ + 1;
  363.          }
  364.          this.doSearch(_loc6_,_loc7_,_loc12_);
  365.       }
  366.    }
  367.    function onSearchTypeChange(evtObj)
  368.    {
  369.       this.clearUI();
  370.       this.mRoot.mc_SearchResult.clearUI();
  371.       this.mSearchType = evtObj.target.selection.data;
  372.       if(this.mSearchType == "mostra")
  373.       {
  374.          this.mRoot.mc_TabMostra._visible = true;
  375.          this.mRoot.btnStartSearch.setState(false);
  376.          this.mRoot.mc_SearchResult.SetState("mostra");
  377.          this.doSearch("","",this.GetSearchDataStr());
  378.       }
  379.       else
  380.       {
  381.          this.mRoot.mc_TabMostra._visible = false;
  382.          this.mRoot.btnStartSearch.setState(true);
  383.          this.mRoot.mc_SearchResult.SetState("cerca");
  384.       }
  385.    }
  386.    function onPreviewClick(evtObj)
  387.    {
  388.       if(evtObj.where == "image")
  389.       {
  390.          if(evtObj.tipo == "P" && this.mProspettiva.mFile != "")
  391.          {
  392.             this.mProspettiva.mFrom = "ricerca";
  393.             this.mProspettiva.mStatus = null;
  394.             this.OpenProspettiveWindow(this.mProspettiva);
  395.          }
  396.          else if(this.mContributo.mFile != "")
  397.          {
  398.             this.mContributo.mFrom = "ricerca";
  399.             this.mContributo.mStatus = null;
  400.             this.OpenContributiWindow(this.mContributo);
  401.          }
  402.       }
  403.       else if(evtObj.where == "text" && this.mLemma)
  404.       {
  405.          this.mLemma.mFrom = "ricerca";
  406.          this.mLemma.mStatus = null;
  407.          this.OpenLemmaWindow(this.mLemma);
  408.       }
  409.    }
  410.    function onResultTabChange(evtObj)
  411.    {
  412.       this.mRoot.mc_Preview.Hide();
  413.       this.SetWhere("searchResult_" + evtObj.tab);
  414.       this.UpdateToolbarButton();
  415.    }
  416.    function onHandleWindowMessage(evtObj)
  417.    {
  418.       if(evtObj.action == "open")
  419.       {
  420.          this.SetWhere(evtObj.windowName);
  421.       }
  422.       else
  423.       {
  424.          var _loc2_ = "";
  425.          if(this.mRoot.mc_ZoomWindow._visible == true)
  426.          {
  427.             _loc2_ = "zoom";
  428.          }
  429.          else if(this.mRoot.mc_ProspettiveViewer._visible == true)
  430.          {
  431.             _loc2_ = "prospettive";
  432.          }
  433.          else if(this.mRoot.mc_MenuProspettive._visible == true)
  434.          {
  435.             _loc2_ = "menuProspettive";
  436.          }
  437.          else if(this.mRoot.mc_ContributiWindow._visible == true)
  438.          {
  439.             _loc2_ = "contributi";
  440.          }
  441.          else if(this.mRoot.mc_LemmaViewer._visible == true)
  442.          {
  443.             _loc2_ = "lemma";
  444.          }
  445.          else
  446.          {
  447.             _loc2_ = "searchResult_" + this.mRoot.mc_SearchResult.ActiveTab();
  448.          }
  449.          this.SetWhere(_loc2_);
  450.       }
  451.       this.UpdateToolbarButton();
  452.    }
  453.    function UIEnableClickOnLabel()
  454.    {
  455.       this.mRoot.rbSearchOnTitle.mUseAlphaInSetHitArea = true;
  456.       this.mRoot.rbFullSearch.mUseAlphaInSetHitArea = true;
  457.       this.mRoot.rbOrSearch.mUseAlphaInSetHitArea = true;
  458.       this.mRoot.rbAndSearch.mUseAlphaInSetHitArea = true;
  459.       this.mRoot.rbFullSearch.mUseAlphaInSetHitArea = true;
  460.       this.mRoot.cbWholeWords.mUseAlphaInSetHitArea = true;
  461.       this.mRoot.cbCaseSensitive.mUseAlphaInSetHitArea = true;
  462.       this.mRoot.rbShowFullIndex.mUseAlphaInSetHitArea = true;
  463.       this.mRoot.rbSearchIndex.mUseAlphaInSetHitArea = true;
  464.    }
  465.    function initUI()
  466.    {
  467.       this.UIEnableClickOnLabel();
  468.       if(_global.gDVD == true)
  469.       {
  470.          this.mRoot.mc_Esci.onPress = mx.utils.Delegate.create(this,this.onEsci);
  471.          this.mRoot.mc_Iconizza.onPress = mx.utils.Delegate.create(this,this.onIconizza);
  472.       }
  473.       else
  474.       {
  475.          this.mRoot.mc_Esci._visible = false;
  476.          this.mRoot.mc_Iconizza._visible = false;
  477.       }
  478.       this.mRoot.ibSearchInput.maxChars = 256;
  479.       this.mRoot.ibSearchInput.setStyle("fontFamily","Arial Unicode MS");
  480.       this.mRoot.ibSearchInput.setStyle("fontSize ",10);
  481.       this.mRoot.ibSearchInput.setStyle("borderStyle","solid");
  482.       this.mRoot.ibSearchInput.setStyle("borderColor",12566711);
  483.       this.mRoot.ibSearchInput.embedFonts = _global.gUseEmbeddedFont;
  484.       this.mRoot.ibExcludeWords.maxChars = 256;
  485.       this.mRoot.ibExcludeWords.setStyle("fontFamily","Arial Unicode MS");
  486.       this.mRoot.ibExcludeWords.setStyle("fontSize ",10);
  487.       this.mRoot.ibExcludeWords.setStyle("borderStyle","solid");
  488.       this.mRoot.ibExcludeWords.setStyle("borderColor",12566711);
  489.       this.mRoot.ibExcludeWords.embedFonts = _global.gUseEmbeddedFont;
  490.       if(_global.gUseEmbeddedFont)
  491.       {
  492.          this.mRoot.ibExcludeWords.setStyle("fontWeight","bold");
  493.          this.mRoot.ibSearchInput.setStyle("fontWeight","bold");
  494.          this.mRoot.ibExcludeWords.setStyle("fontColor","#444444");
  495.          this.mRoot.ibSearchInput.setStyle("fontColor","#444444");
  496.       }
  497.       this.mRoot.searchTypeGroup.addEventListener("click",mx.utils.Delegate.create(this,this.onSearchTypeChange));
  498.       this.mRoot.btnStartSearch.addEventListener("click",mx.utils.Delegate.create(this,this.onSearch));
  499.       this.mRoot.ibSearchInput.addEventListener("enter",mx.utils.Delegate.create(this,this.onSearch));
  500.       this.mRoot.mc_Preview.addEventListener("previewClick",mx.utils.Delegate.create(this,this.onPreviewClick));
  501.       this.mRoot.mc_TabMostra._visible = true;
  502.       this.mRoot.mc_TabMostra.useHandCursor = false;
  503.       this.mRoot.mc_TabMostra.onPress = function()
  504.       {
  505.       };
  506.       this.mRoot.mc_LemmaViewer.addEventListener("onXXIWindowMessage",mx.utils.Delegate.create(this,this.onHandleWindowMessage));
  507.       this.mRoot.mc_ContributiWindow.addEventListener("onXXIWindowMessage",mx.utils.Delegate.create(this,this.onHandleWindowMessage));
  508.       this.mRoot.mc_ProspettiveViewer.addEventListener("onXXIWindowMessage",mx.utils.Delegate.create(this,this.onHandleWindowMessage));
  509.       this.mRoot.mc_ZoomWindow.addEventListener("onXXIWindowMessage",mx.utils.Delegate.create(this,this.onHandleWindowMessage));
  510.       this.mRoot.mc_SearchResult.addEventListener("resultTabChange",mx.utils.Delegate.create(this,this.onResultTabChange));
  511.    }
  512.    function clearUI()
  513.    {
  514.       this.mRoot.mc_Preview.Hide();
  515.       this.mRoot.ibSearchInput.text = "";
  516.       this.mSearchData = this.GetSearchData();
  517.       this.mRoot.lblTitolo.text = "";
  518.       this.mRoot.ibExcludeWords.text = "";
  519.    }
  520.    function OpenContributiWindow(inContributo)
  521.    {
  522.       this.HistoryUpdate(inContributo,inContributo.mFrom);
  523.       this.CloseAllWindows();
  524.       this.mRoot.mc_ContributiWindow.MostraContributo(inContributo,inContributo.mFrom);
  525.    }
  526.    function OpenProspettiveWindow(inProspettiva, inFrom)
  527.    {
  528.       this.HistoryUpdate(inProspettiva,inProspettiva.mFrom);
  529.       this.CloseAllWindows();
  530.       this.mRoot.mc_ProspettiveViewer.MostraProspettiva(inProspettiva,inProspettiva.mFrom);
  531.    }
  532.    function OpenLemmaWindow(inLemma)
  533.    {
  534.       this.HistoryUpdate(inLemma,inLemma.mFrom);
  535.       this.CloseAllWindows();
  536.       this.mRoot.mc_LemmaViewer.MostraLemma(inLemma,inLemma.mFrom);
  537.    }
  538.    function OpenZoomWindow(inContributo, inFrom)
  539.    {
  540.       this.mRoot.mc_ZoomWindow.ZoomContributo(inContributo,inFrom);
  541.    }
  542.    function ZoomImage(inTile, inUrl)
  543.    {
  544.       this.mRoot.mc_ZoomWindow.ZoomImage(inTile,inUrl);
  545.    }
  546.    function ShowLemmaPreview(inLemma)
  547.    {
  548.       this.mRoot.mc_Preview.ShowText(inLemma.GetPreview());
  549.    }
  550.    function ShowContributiPreview(inContributo)
  551.    {
  552.       this.mRoot.mc_Preview.ShowImage(inContributo);
  553.    }
  554.    function ShowProspettivePreview(inProspettiva)
  555.    {
  556.       this.mRoot.mc_Preview.ShowImage(inProspettiva);
  557.    }
  558.    function CloseAllWindows()
  559.    {
  560.       this.mRoot.mc_ProspettiveViewer.Close();
  561.       this.mRoot.mc_ContributiWindow.Close();
  562.       this.mRoot.mc_LemmaViewer.Close();
  563.       this.mRoot.mc_DialogManager.Show(false);
  564.       this.mRoot.mc_MenuProspettive._visible = false;
  565.    }
  566.    function Back()
  567.    {
  568.       if(this.mTornaArray.length > 0)
  569.       {
  570.          var _loc2_ = this.mTornaArray.pop();
  571.          if(_loc2_.from == "ricerca")
  572.          {
  573.             this.InitSearch(false);
  574.             this.CloseAllWindows();
  575.          }
  576.          else if(_loc2_.from == "menuProspettive")
  577.          {
  578.             this.MenuProspettive(true);
  579.          }
  580.          else if(_loc2_.from == "prospettiva")
  581.          {
  582.             this.MostraProspettiva(_loc2_.id,_loc2_.tipo,_loc2_.titolo,"back_" + this.mTornaArray[this.mTornaArray.length - 1].from,true,_loc2_.status);
  583.          }
  584.          else if(_loc2_.from == "lemma")
  585.          {
  586.             this.MostraLemma(_loc2_.id,_loc2_.tipo,_loc2_.titolo,"back_" + this.mTornaArray[this.mTornaArray.length - 1].from,true,_loc2_.status);
  587.          }
  588.          else if(_loc2_.from == "contributo")
  589.          {
  590.             this.MostraContributo(_loc2_.id,_loc2_.tipo,_loc2_.titolo,"back_" + this.mTornaArray[this.mTornaArray.length - 1].from,true,_loc2_.status);
  591.          }
  592.       }
  593.    }
  594.    function HistoryUpdate(inObject, inFrom)
  595.    {
  596.       if(inFrom == "ricerca" || inFrom == "menuProspettive")
  597.       {
  598.          this.mTornaArray.push({from:inFrom,id:0,titolo:"",tipo:""});
  599.       }
  600.       else if(inFrom == "prospettiva")
  601.       {
  602.          this.mTornaArray.push({from:inFrom,id:this.mProspettiva.mId,titolo:this.mProspettiva.mTitolo,tipo:this.mProspettiva.mTipo,status:null});
  603.       }
  604.       else if(inFrom == "contributo")
  605.       {
  606.          this.mTornaArray.push({from:inFrom,id:this.mContributo.mId,titolo:this.mContributo.mTitolo,tipo:this.mContributo.mTipo,status:null});
  607.       }
  608.       else if(inFrom == "lemma")
  609.       {
  610.          this.mTornaArray.push({from:inFrom,id:this.mLemma.mId,titolo:this.mLemma.mTitolo,tipo:this.mLemma.mTipo,status:this.mRoot.mc_LemmaViewer.GetStatus()});
  611.       }
  612.       if(inFrom != "history" && inFrom.indexOf("back_") < 0)
  613.       {
  614.          this.mHistory.Add(inObject,inFrom);
  615.          this.mRoot.mc_toolbar.RefreshHistoryButton(this.mHistory);
  616.       }
  617.       this.mLastVisitedItem = {data:inObject,from:inFrom};
  618.    }
  619.    function HistoryBack()
  620.    {
  621.       this.HistoryGotoItem(this.mHistory.Back());
  622.    }
  623.    function HistoryNext()
  624.    {
  625.       this.HistoryGotoItem(this.mHistory.Forward());
  626.    }
  627.    function HistoryGoto(inPos)
  628.    {
  629.       this.HistoryGotoItem(this.mHistory.Goto(inPos));
  630.    }
  631.    function GetHistoryData(inPos)
  632.    {
  633.       return this.mHistory.GetData();
  634.    }
  635.    function HistoryGotoItem(historyItem)
  636.    {
  637.       if(historyItem)
  638.       {
  639.          if(historyItem.tipo == "L" || historyItem.tipo == "R")
  640.          {
  641.             this.mRoot.mc_ContributiWindow.Hide();
  642.             this.MostraLemma(historyItem.id,historyItem.tipo,historyItem.titolo,"history",true);
  643.          }
  644.          else if(historyItem.tipo == "P")
  645.          {
  646.             this.MostraProspettiva(historyItem.id,historyItem.tipo,historyItem.titolo,"history",true);
  647.          }
  648.          else
  649.          {
  650.             this.mRoot.mc_LemmaViewer.Hide();
  651.             this.MostraContributo(historyItem.id,historyItem.tipo,historyItem.titolo,"history",true);
  652.          }
  653.          this.mRoot.mc_toolbar.RefreshHistoryButton(this.mHistory);
  654.       }
  655.    }
  656.    function UpdateToolbarButton()
  657.    {
  658.       var _loc3_ = false;
  659.       var _loc2_ = false;
  660.       var _loc5_ = false;
  661.       if(this.mWhere == "contributi")
  662.       {
  663.          _loc2_ = false;
  664.       }
  665.       else if(this.mWhere == "prospettive" || this.mRoot.mc_MenuProspettive._visible == true)
  666.       {
  667.          _loc2_ = _loc3_ = false;
  668.       }
  669.       else if(this.mWhere == "lemma")
  670.       {
  671.          _loc2_ = _loc3_ = true;
  672.       }
  673.       else if(this.mSearchType != "mostra")
  674.       {
  675.          var _loc4_ = this.mRoot.mc_SearchResult.GetActiveTabList();
  676.          _loc2_ = _loc3_ = _loc4_.length > 0;
  677.       }
  678.       this.mRoot.mc_toolbar.EnableButton("cbtn_Copia",_loc3_);
  679.       this.mRoot.mc_toolbar.EnableButton("cbtn_Stampa",_loc2_);
  680.    }
  681.    function Copy(inWhat)
  682.    {
  683.       var _loc2_ = false;
  684.       if(this.mRoot.mc_ContributiWindow._visible == true)
  685.       {
  686.          this.mRoot.mc_ContributiWindow.Copy();
  687.       }
  688.       else if(this.mRoot.mc_LemmaViewer._visible == true)
  689.       {
  690.          _loc2_ = this.mRoot.mc_LemmaViewer.Copy(inWhat);
  691.       }
  692.       else if(this.mSearchType != "mostra")
  693.       {
  694.          this.mRoot.mc_SearchResult.Copy();
  695.       }
  696.       return _loc2_;
  697.    }
  698.    function Save(inWhat)
  699.    {
  700.       var _loc2_ = false;
  701.       if(this.mRoot.mc_ContributiWindow._visible == true)
  702.       {
  703.          this.mRoot.mc_ContributiWindow.Save();
  704.       }
  705.       else if(this.mRoot.mc_LemmaViewer._visible == true)
  706.       {
  707.          _loc2_ = this.mRoot.mc_LemmaViewer.Save(inWhat);
  708.       }
  709.       else if(this.mSearchType != "mostra")
  710.       {
  711.          this.mRoot.mc_SearchResult.Save();
  712.       }
  713.       return _loc2_;
  714.    }
  715.    function Print(inWhat)
  716.    {
  717.       var _loc2_ = false;
  718.       if(this.mRoot.mc_ContributiWindow._visible == true)
  719.       {
  720.          this.mRoot.mc_ContributiWindow.Print();
  721.       }
  722.       else if(this.mRoot.mc_LemmaViewer._visible == true)
  723.       {
  724.          _loc2_ = this.mRoot.mc_LemmaViewer.Print(inWhat);
  725.       }
  726.       else if(this.mSearchType != "mostra")
  727.       {
  728.          this.mRoot.mc_SearchResult.Print();
  729.       }
  730.       return _loc2_;
  731.    }
  732.    function ExportHtmlFile(inName, inCss, inHeader, inBody)
  733.    {
  734.       var _loc7_ = _root.gNormalize.Normalize(inName);
  735.       var _loc8_ = StringUtils.trim(_loc7_.text);
  736.       inName = inName.split("'").join("'");
  737.       inHeader = inHeader.split("'").join("'");
  738.       inBody = inBody.split("'").join("'");
  739.       if(_global.gDVD == true)
  740.       {
  741.          this.mService.DoHtmlExport(inName,inCss,inHeader,inBody);
  742.       }
  743.       else
  744.       {
  745.          _global.gHtmlExportClip.filename = _loc8_;
  746.          _global.gHtmlExportClip.css = inCss;
  747.          _global.gHtmlExportClip.header = inHeader;
  748.          _global.gHtmlExportClip.body = inBody;
  749.          _global.gHtmlExportClip.getURL(CAppendiceSearch.EXPORTHTML_URL,"_blank","POST");
  750.       }
  751.    }
  752.    function SetWhere(inWhere)
  753.    {
  754.       this.mWhere = inWhere;
  755.    }
  756.    function Aiuto()
  757.    {
  758.       if(this.mRoot.mc_DialogManager)
  759.       {
  760.          var _loc2_ = "MenuGenerale";
  761.          if(this.mRoot.mc_MenuProspettive._visible)
  762.          {
  763.             _loc2_ = "ProspettiveMenu";
  764.          }
  765.          else if(this.mRoot.mc_LemmaViewer._visible)
  766.          {
  767.             _loc2_ = "AppendiceVoce";
  768.          }
  769.          else if(this.mRoot.mc_ContributiWindow._visible)
  770.          {
  771.             _loc2_ = "AppendiceContributi";
  772.          }
  773.          else if(this.mRoot.mc_ProspettiveViewer._visible)
  774.          {
  775.             this.PausaMovie();
  776.             _loc2_ = "AppendiceProspettive";
  777.          }
  778.          else if(this.mSearchType != "mostra")
  779.          {
  780.             _loc2_ = "AppendiceCerca";
  781.          }
  782.          else
  783.          {
  784.             _loc2_ = "AppendiceLista";
  785.          }
  786.          this.mRoot.mc_DialogManager.LoadContents(CAppendiceSearch.HELP_URL,_loc2_,true);
  787.       }
  788.    }
  789.    function Crediti()
  790.    {
  791.       if(this.mRoot.mc_DialogManager)
  792.       {
  793.          this.PausaMovie();
  794.          this.mRoot.mc_DialogManager.LoadContents(CAppendiceSearch.CREDITS_URL,"",true);
  795.       }
  796.    }
  797.    function MenuProspettive(inInit)
  798.    {
  799.       this.CloseAllWindows();
  800.       if(inInit == true)
  801.       {
  802.          this.InitMenuProspettive();
  803.       }
  804.       this.mRoot.mc_MenuProspettive._visible = true;
  805.       this.SetWhere("menuProspettive");
  806.       this.UpdateToolbarButton();
  807.    }
  808.    function Ricerca()
  809.    {
  810.       this.CloseAllWindows();
  811.       this.InitSearch(false);
  812.       this.UpdateToolbarButton();
  813.    }
  814.    function onEsci()
  815.    {
  816.       this.PausaMovie();
  817.       var _loc4_ = "Si conferma di voler uscire dalla Settima Appendice della Enciclopedia Italiana di Scienze, Lettere ed Arti?";
  818.       var _loc3_ = new Array();
  819.       _global.gAlert.SetCallback("YES",this,"doEsci",_loc3_);
  820.       _global.gAlert.ShowAlert("",_loc4_,"YESNO",10);
  821.    }
  822.    function doEsci()
  823.    {
  824.       if(_global.gDVD == true)
  825.       {
  826.          this.mRoot.getURL("lingo: AppendiceEsci");
  827.       }
  828.       else
  829.       {
  830.          this.mRoot.getURL("javascript:AppendiceEsci();");
  831.       }
  832.    }
  833.    function onIconizza()
  834.    {
  835.       if(_global.gDebug)
  836.       {
  837.          setInterval(_root.CaricaLemmaDebug,200);
  838.       }
  839.       else
  840.       {
  841.          this.PausaMovie();
  842.          if(_global.gDVD == true)
  843.          {
  844.             this.mRoot.getURL("lingo: AppendiceIconizza");
  845.          }
  846.       }
  847.    }
  848.    function PausaMovie()
  849.    {
  850.       if(this.mRoot.mc_ProspettiveViewer._visible)
  851.       {
  852.          this.mRoot.mc_ProspettiveViewer.PauseMovie();
  853.       }
  854.    }
  855. }
  856.